package regex
import org.junit.Test
import java.util.regex.Pattern

class TestRegex {
    @Test
    fun testRegex() {
        //目标是否匹配标准
        val data = "123"
        println(data.matches(Regex("[1-9]\\d+")))

        val data1 = "00d11111007"
        //是否被包含
        println(Regex.fromLiteral("d11").containsMatchIn(data1))

        //标准是否涵盖目标
        val regex = Regex("[1-9]\\d+")
        println(regex.matches("1204"))
        println(regex.containsMatchIn("1204a"))

        //标准是否涵盖目标
        val pattern = Pattern.compile("[1-9]\\d+")
        val matcher = pattern.matcher("1234")
        println(matcher.matches())
    }
}